<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
    <head>
        <title>查询积分</title>
    </head>
    <body>
        <div id="customersPointGrid" class="x-form-item">
        </div>
        <script>

            Ext.onReady(function(){

                //############## Grid ##############
                var customerCM = new Ext.grid.ColumnModel([new Ext.grid.RowNumberer(), {
                        id: 'id',
                        header: "序号",
                        dataIndex: 'id',
                        width: 50,
                        hidden: true
                    }, {
                        header: "客户名称",
                        width: 100,
                        dataIndex: 'name'
                    }, {
                        header: "性别",
                        width: 50,
                        dataIndex: 'sex',
                        hidden: true
                    }, {
                        header: "电话",
                        width: 100,
                        dataIndex: 'phone',
                        hidden: true
                    }, {
                        header: "证件类型",
                        width: 60,
                        dataIndex: 'card_type',
                        hidden: true
                    }, {
                        header: "证件号码",
                        width: 90,
                        dataIndex: 'card',
                        hidden: true
                    }, {
                        header: "生日",
                        width: 80,
                        dataIndex: 'birthday',
                        renderer: Ext.util.Format.dateRenderer('Y-m-d'),
                        hidden: true
                    }, {
                        header: "会员卡号",
                        width: 100,
                        dataIndex: 'customer_no'
                    }, {
                        header: "联系人",
                        width: 80,
                        dataIndex: 'linkman',
                        hidden: true
                    }, {
                        header: "联系人电话",
                        width: 90,
                        dataIndex: 'linkman_phone',
                        hidden: true
                    }, {
                        header: "地址",
                        width: 100,
                        dataIndex: 'address',
                        hidden: true
                    }, {
                        header: "类型",
                        width: 70,
                        dataIndex: 'customer_type'
                    }, {
                        header: "当前积分",
                        width: 100,
                        dataIndex: 'point'
                    }, {
                        header: "累计积分",
                        width: 100,
                        dataIndex: 'point_his'
                    }, {
                        header: "累计消费",
                        width: 100,
                        dataIndex: 'expenditure'
                    }, {
                        header: "历史消费",
                        width: 100,
                        dataIndex: 'expenditure_his'
                    }, {
                        header: "票款合计",
                        width: 100,
                        dataIndex: 'price'
                    }, {
                        header: "税款合计",
                        width: 100,
                        dataIndex: 'tax'
                    }, {
                        header: "附加合计",
                        width: 100,
                        dataIndex: 'fuel'
                        /*
                    }, {
                        header: "当前积分(历史)",
                        width: 100,
                        dataIndex: 'point_old'
                    }, {
                        header: "累计积分(历史)",
                        width: 100,
                        dataIndex: 'point_his_old'
                    }, {
                        header: "累计消费(历史)",
                        width: 100,
                        dataIndex: 'expenditure_old'
                    }, {
                        header: "历史消费(历史)",
                        width: 100,
                        dataIndex: 'expenditure_his_old'
                    }, {
                        header: "票款合计(历史)",
                        width: 100,
                        dataIndex: 'price_old'
                    }, {
                        header: "税款合计(历史)",
                        width: 100,
                        dataIndex: 'tax_old'
                    }, {
                        header: "附加合计(历史)",
                        width: 100,
                        dataIndex: 'fuel_old'
                         */
                    }]);

                var customerDS = new Ext.data.Store({
                    proxy: new Ext.data.HttpProxy({
                        url: '/ticket/getCustomersPoint'
                    }),
                    reader: new Ext.data.JsonReader({
                        root: 'root'
                    }, [{
                            name: 'id'
                        }, {
                            name: 'name'
                        }, {
                            name: 'sex'
                        }, {
                            name: 'phone'
                        }, {
                            name: 'card_type',
                            mapping: 'card_type.card_type'
                        }, {
                            name: 'card'
                        }, {
                            name: 'birthday'
                        }, {
                            name: 'customer_no'
                        }, {
                            name: 'address'
                        }, {
                            name: 'linkman'
                        }, {
                            name: 'linkman_phone'
                        }, {
                            name: 'customer_type',
                            mapping: 'customer_type.customer_type'
                        }, {
                            name: 'customer_level'
                        }, {
                            name: 'point'
                        }, {
                            name: 'point_his'
                        }, {
                            name: 'expenditure'
                        }, {
                            name: 'expenditure_his'
                        }, {
                            name: 'price'
                        }, {
                            name: 'tax'
                        }, {
                            name: 'fuel'
                        }, {
                            name: 'point_old'
                        }, {
                            name: 'point_his_old'
                        }, {
                            name: 'expenditure_old'
                        }, {
                            name: 'expenditure_his_old'
                        }, {
                            name: 'price_old'
                        }, {
                            name: 'tax_old'
                        }, {
                            name: 'fuel_old'
                        }])
                });

                var customerGridPanel = new Ext.grid.GridPanel({
                    //border: false,
                    el: 'customersPointGrid',
                    ds: customerDS,
                    cm: customerCM,
                    //iconCls: 'icon-grid',
                    loadMask: true,
                    autoWidth: true,
                    collapsible: true,
                    animCollapse: true,
                    height: 200,
                    //frame: true,
                    title: '积分消费信息'
                });

                customerGridPanel.render();
                customerDS.load();

            })
        </script>
    </body>
</html>

